package uk.ac.cam.echo.social;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;
import com.facebook.android.AsyncFacebookRunner.RequestListener;
import com.facebook.android.FacebookError;

public abstract class SimplifiedRequestListener implements RequestListener
{
	protected abstract void runOnError(String errorText);

	@Override
	public abstract void onComplete(String response, Object state);

	@Override
	public void onIOException(IOException e, Object state)
	{
		runOnError("IOException\n" + e.getMessage());
	}

	@Override
	public void onFileNotFoundException(FileNotFoundException e, Object state)
	{
		runOnError("FileNotFoundException\n" + e.getMessage());
	}

	@Override
	public void onMalformedURLException(MalformedURLException e, Object state)
	{
		runOnError("MalformedURLException\n" + e.getMessage());
	}

	@Override
	public void onFacebookError(FacebookError e, Object state)
	{
		runOnError("FacebookError\n" + e.getMessage());
	}
}
